<!-- 必须全局拥有唯一的id -->
<div id="messagetemplate">
  <yu-panel :title="$t('template.xxmb')" :hide-filter="false">
    <template slot="filter">
      <yu-xform v-model="formdata" related-table-name="messagetemplateTable" form-type="search">
        <yu-xform-group :column="4">
          <yu-xform-item :label="$t('template.lx')" :placeholder="$t('template.lx')" ctype="select" name="templateType"
            data-code="TEMPLATE_TYPE"></yu-xform-item>
          <yu-xform-item :label="$t('template.ms')" :placeholder="$t('template.ms')" ctype="input" name="messageDesc">
          </yu-xform-item>
        </yu-xform-group>
      </yu-xform>
    </template>
    <!-- 搜索栏 -->
    <!-- 工具栏 -->
    <template slot="right">
      <yu-toolBar>
        <el-button @click="openCreateFn">{{ $t('template.xz') }}</el-button>
        <el-button @click="deleteOp">{{ $t('template.sc') }}</el-button>
        <el-button @click="editOp">{{ $t('template.bj') }}</el-button>
        <el-button @click="sendOp">{{ $t('template.fscs') }}</el-button>
      </yu-toolBar>
    </template>

    <!-- 表格 -->
    <el-table-x ref="messagetemplateTable" :max-height="height" :data-url="urls.dataUrl" :table-columns="tableColumns"
      @custom-row-op="customRowOp">
    </el-table-x>
  </yu-panel>

  <el-dialog :title="$t('template.xxpz')" :visible.sync="dialogVisible">
    <el-form ref="form0" :model="form0" label-width="80px" :rules="rules0">
      <el-form-item :label="$t('template.xxlx')" prop="messageType" v-show="!editVisible">
        <el-input v-model="form0.messageType"></el-input>
      </el-form-item>
      <el-form-item :label="$t('template.xxdj')" prop="messageLevel">
        <el-select v-model="form0.messageLevel">
          <el-option :label="$t('template.hd')" value="1"></el-option>
          <el-option :label="$t('template.d')" value="2"></el-option>
          <el-option :label="$t('template.zd')" value="3"></el-option>
          <el-option :label="$t('template.g')" value="4"></el-option>
          <el-option :label="$t('template.hg')" value="5"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item :label="$t('template.mblx')" prop="templateType">
        <el-select v-model="form0.templateType">
          <el-option :label="$t('template.ssxx')" value="S"></el-option>
          <el-option :label="$t('template.dyxx')" value="D"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item :label="$t('template.ms')" prop="messageDesc">
        <el-input v-model="form0.messageDesc"></el-input>
      </el-form-item>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button type="primary" @click="saveOp()">{{ $t('template.bc') }}</el-button>
      <el-button @click="dialogVisible = false">{{ $t('template.qx') }}</el-button>
    </div>
  </el-dialog>


  <el-dialog :title="$t('template.mbbj')" :visible.sync="templateDialogVisible" @open="open()">
    <el-form ref="form" :model="form" label-width="80px" :rules="rules">
      <el-form-item :label="$t('template.yczfcs')" prop="sendNum">
        <el-select v-model.number="form.sendNum">
          <el-option label="0" value="0"></el-option>
          <el-option label="1" value="1"></el-option>
          <el-option label="2" value="2"></el-option>
          <el-option label="3" value="3"></el-option>
        </el-select>
      </el-form-item>

      <el-form-item :label="$t('template.mbnr')" prop="templateContent">
        <el-input type="textarea" v-model="form.templateContent"></el-input>
      </el-form-item>

      <el-form-item :label="$t('template.bt')" v-show="emailVisible">
        <el-input v-model="form.emailTitle"></el-input>
      </el-form-item>

      <el-form-item :label="$t('template.mdr')" v-show="timeVisible">
        <el-radio v-for="item in isTimes" v-model="form.isTime" :label="item">{{isTimesMap[item]}}</el-radio>
      </el-form-item>
      <el-form-item :label="$t('template.xxbz')" hidden="true">
        <el-input v-model="form.messageType"></el-input>
      </el-form-item>
      <el-form-item :label="$t('template.qdlx')" hidden="true">
        <el-input v-model="form.channelType"></el-input>
      </el-form-item>
      <el-form-item :label="$t('template.mblx')" hidden="true">
        <el-input v-model="form.templateType"></el-input>
      </el-form-item>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button type="primary" @click="saveTemplate()">{{ $t('template.qd') }}</el-button>
      <el-button @click="templateDialogVisible = false">{{ $t('template.qx') }}</el-button>
      <el-button @click="deleteTemplate()">{{ $t('template.sc') }}</el-button>
    </div>
  </el-dialog>

</div>